<ui:composition template="/template/template-professor.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="corpo">
        <h:form id="pa">
            <p:growl id="message" showDetail="true" life="5000"/>

            <div style="font-size: 13px; padding-bottom: 5% !important;">
		<p:dataTable id="Alunos" var="aluno" value="#{gerenciaAluno.alunos}" widgetVar="alunoTable"
			     emptyMessage="Não há alunos disponíveis" paginator="true" rows="10">

		    <p:column id="ativo" headerText="Ativo">
			<!--                            <p:graphicImage rendered="{cadastraAlunoManagedBean.isAtivo(aluno)}"
								    value="../img/yes.png"/>
						    <p:graphicImage rendered="{not cadastraAlunoManagedBean.isAtivo(aluno)}"
								    value="../img/no.jpg"/>-->
			<h:outputText value="Sim" rendered="#{gerenciaAluno.isAtivo(aluno)}"/>
			<h:outputText value="Não" rendered="#{not gerenciaAluno.isAtivo(aluno)}"/>
		    </p:column>

		    <p:column id="email" headerText="e-mail">
			<h:outputText value="#{aluno.email}"/>
		    </p:column>

		    <p:column id="nome" headerText="Nome">
			<h:outputText value="#{aluno.nome}"/>
		    </p:column>

		    <p:column id="sobrenome" headerText="Sobrenome">
			<h:outputText value="#{aluno.sobrenome}"/>
		    </p:column>

		    <p:column id="Seleção">
			<p:commandButton icon="ui-icon-pencil" action="altera-aluno">
                            <f:setPropertyActionListener value="#{aluno}" target="#{gerenciaAluno.aluno}" />
                        </p:commandButton>
			<p:commandButton icon="ui-icon-trash" update="ativo" action="#{gerenciaAluno.remover(aluno)}"
					 rendered="#{gerenciaAluno.isAtivo(aluno)}"/>
		    </p:column>

		</p:dataTable>

		<p:separator />
		<p:panel>
                    <p:commandButton value="Novo" action="../conteudo-professor/cadastrar-aluno.xhtml?faces-redirect=true"/>
		</p:panel>
            </div>
        </h:form>
    </ui:define>
</ui:composition>